import 'package:flutter/material.dart';
import 'package:ljy_flutter/change_notifier_proxy_privoder_ex/widgets/book_item.dart';
import 'package:provider/provider.dart';
import 'package:ljy_flutter/change_notifier_proxy_privoder_ex/models/book_manger_model.dart';

class PageB extends StatelessWidget {
  const PageB({super.key});

  @override
  Widget build(BuildContext context) {
    var bookManagerModel = Provider.of<BookMangerModel>(context);
    var bookCount = bookManagerModel.length;

    return Scaffold(
      appBar: AppBar(title: Text('收藏列表')),
      body: ListView.builder(
        itemCount: bookCount,
        itemBuilder: (context, index) {
          return BookItem(id: bookManagerModel.getByPosition(index).bookId);
        },
      ),
    );
  }
}
